home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / gfx / show / gs_src_gs.lha / gs5.03 / gxctable.h < prev    next >
C/C++ Source or Header  |  1995-08-27  |  2KB  |  59 lines

  1. /* Copyright (C) 1995 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gxctable.h */
  20. /* Interface to color table lookup and interpolation */
  21. #include "gxfixed.h"
  22. #include "gxfrac.h"
  23.  
  24. /*
  25.  * Define a 3- or 4-D color lookup table.
  26.  * n is the number of dimensions (input indices), 3 or 4.
  27.  * dims[0..n-1] are the table dimensions.
  28.  * m is the number of output values, 3 or 4.
  29.  * For n = 3:
  30.  *   table[i], 0 <= i < dims[0], point to strings of length
  31.  *     dims[1] x dims[2] x m.
  32.  * For n = 4:
  33.  *   table[i], 0 <= i < dims[0] x dims[1], points to strings of length
  34.  *     dims[2] x dims[3] x m.
  35.  * It isn't really necessary to store the size of each string, since
  36.  * they're all the same size, but it makes things a lot easier for the GC.
  37.  */
  38. typedef struct gx_color_lookup_table_s {
  39.     int n;
  40.     int dims[4];        /* [ndims] */
  41.     int m;
  42.     const gs_const_string *table;
  43. } gx_color_lookup_table;
  44.  
  45. /*
  46.  * Interpolate in a 3- or 4-D color lookup table.
  47.  * pi[0..n-1] are the table indices, guaranteed to be in the ranges
  48.  * [0..dims[n]-1] respectively.
  49.  * Return interpolated values in pv[0..m-1].
  50.  */
  51.  
  52. /* Return the nearest value without interpolation. */
  53. void gx_color_interpolate_nearest(P3(const fixed *pi,
  54.   const gx_color_lookup_table *pclt, frac *pv));
  55.  
  56. /* Use trilinear interpolation. */
  57. void gx_color_interpolate_linear(P3(const fixed *pi,
  58.   const gx_color_lookup_table *pclt, frac *pv));
  59.